<#macro templateTree field filepath="">
    <@_templateList path=filepath>
        <@_metadata dir=filepath><#local metaDataMap=object/></@_metadata>
        <#list list as a>
        <li>
            <#local path=filepath+'/'+a.fileName/>
        <#if a.directory>
            <a href="javascript:;" data="${path!}" onclick="$.bringBack({'${field}':'${path}'});return false;">${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}</a>
            <ul>
                <@templateTree field path/>
            </ul>
        </#if>
        </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@_templateList>
</#macro>
<div class="pageFormContent" layoutH="19">
    <ul class="tree treeFolder">
        <@templateTree field/>
    </ul>
    <script>
        $('a[data="${(value?js_string)!}"]',$.pdialog.getCurrent()).parent().addClass('selected');
    </script>
</div>